package com.qf.boot2302.config;

import com.qf.boot2302.interceptor.Interceptor01;
import com.qf.boot2302.interceptor.Interceptor02;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 写拦截器的配置类用来注册拦截器
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    Interceptor01 interceptor01;

    @Autowired
    Interceptor02 interceptor02;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor01)
                .addPathPatterns("/login/dologin")
                .order(10);

        registry.addInterceptor(interceptor02)
                .addPathPatterns("/login/dologin")
                .order(20);
    }
}
